#define _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    int maxArea(vector<int>& height) {
        int max_area = 0;
        for (int left = 0, right = height.size() - 1; left < right; ) {
            int min_height = height[right] < height[left] ? height[right] : height[left];
            max_area = max(max_area, min_height * (right - left));
            if (height[right] > height[left]) left++;
            else right--;
        }
        return max_area;
    }
};